package cn.com.connext.scrm.web.rest.enums;

import org.apache.commons.lang3.StringUtils;


public enum PointSourceEnum {
    TMALL(1, "天猫"),
    JD(2, "京东"),
    SHOPING(3, "爱上威士忌精选"),
    CLUB(4, "帝亚吉欧会员俱乐部"),
    NULL(5, "crm会员系统");
    private int code;
    private String name;

    PointSourceEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static Integer getValue(String req) {
        if (StringUtils.isEmpty(req)) {
            return NULL.code;
        }
        if (req.contains(TMALL.name)) {
            return TMALL.code;
        }
        if (req.contains(JD.name)) {
            return JD.code;
        }
        if (req.contains(SHOPING.name)) {
            return SHOPING.code;
        }
        return CLUB.code;
    }
}
